﻿<%@ Page Language="C#" MasterPageFile="~/Views\Home\test.master" Inherits="System.Web.Mvc.ViewPage" %>
 		<asp:Content ContentPlaceHolderID="test" runat="server">
 			<div class="tab_container">
   				 <div id="tab5" class="tab_content">
   				 	<div class="sub_content">USER PROFILE</div>
   				 	<input type="hidden" id="userid" name="userid" value="<%= Html.Encode(ViewData["user_ID"]) %>" />
   				  	<div class="success" id="u_accountsuccess">Account successfully edited.</div>
   				 	<div class="error" id="u_accounterror">Unable to edit. Username already exists. Try another username.</div>
   				 	<div class="error" id="u_accountemail">Unable to edit. Incorrect format of email address.</div>
   				 	<div class="error" id="u_accounterror2">Unable to edit. Please fill all the necessary information.</div>
   				 	<table width="100%" cellspacing="0">
   				 	<tr><td>Username: </td><td><input type="text" id="u_editusername" size="35" disabled="disabled" value="<%= Html.Encode(ViewData["username"]) %>" /></td></tr>
   				 	<tr><td>First Name: </td><td><input type="text" id="u_editfirstname" size="35" disabled="disabled" value="<%= Html.Encode(ViewData["firstname"]) %>" /></td></tr>
   				 	<tr><td>Last Name: </td><td><input type="text" id="u_editlastname" size="35" disabled="disabled" value="<%= Html.Encode(ViewData["lastname"]) %>" /></td></tr>
   				 	<tr><td>E-mail: </td><td><input type="text" id="u_editemail" size="35" disabled="disabled" value="<%= Html.Encode(ViewData["email"]) %>" /></td></tr>
   				 	<tr><td>Contact Number: </td><td><input type="text" id="u_editcontact" size="35" disabled="disabled" value="<%= Html.Encode(ViewData["contactnumber"]) %>" /></td></tr>
   				 	<tr><td>Level: </td><td style="border:0px; font-size:18px">
   				 	<select style="width:140px;" id="u_editlevel" name="editlevel" disabled="disabled" value="<%= Html.Encode(ViewData["level"]) %>" >
		   				<option>User</option>
		   				<option>Librarian</option>
		   				<option>Admin</option>
		   			</select></td></tr>
   				 	</table>
   				 	<br />
   				 	<div class="error" id="u_passconfirm_error">Passwords do not match. Try again.</div>			
   				 	<div class="success" id="u_pass_success">Password successfully changed.</div>	
   				 	<div id="u_changePassword">
   				 	<table width="100%" cellspacing="0">
   				 	<tr><td>New password:</td><td align="left"><input size="35" type="password" id="u_newPassword" /></td></tr>
   				 	<tr><td>Verify password:</td><td align="left"><input size="35" type="password" id="u_confirmNewPassword" /></td></tr>
   				 	</table>
	   				 <br/>
   				 	<input type="button" id="u_editPassword" value="Confirm" />&nbsp;&nbsp;&nbsp;<input type="button" id="u_cancelEditPassword" value="Back" />
   				 	</div>
   				 	<div id="u_editAccounts"><input type="button" id="u_editAccountFinal" value="Save Changes" />&nbsp;&nbsp;&nbsp;<input type="button" id="u_cancelEditAccount" value="Cancel" /></div>
   				 	<div id="u_normalAccount"><input type="button" id="u_editAccount" value="Edit Account" />&nbsp;&nbsp;&nbsp;<input type="button" id="u_changePass" value="Change Password" /></div>
   				 	<br /><br /><div class="sub_content">RESERVATIONS</div>
	   				<div class="success" id="cancel_reservation_success">Reservation successfully cancelled.</div>
	   				<table width="100%" cellspacing="0">
	   					<thead>
	   				  		<td width="60%">Book Title</td>
	   				  		<td width="27%">Date of Reservation</td>
	   				  		<td width="13%"></td>
	   				  	</thead>   				  		
	   				  	<tbody id="tbl_reservations">
						<% foreach (TestProject.Reservation item in (ViewData["reservations"] as List<TestProject.Reservation>)) {%>
						<tr id="<%= Html.Encode(item.reservation_ID) %>_row">
							<td class="book_row" align="center" id="<%= Html.Encode(item.book_isbn) %>_title"><%= Html.Encode(item.bookTitle) %></td>
							<td align="center" id="<%= Html.Encode(item.reservation_ID) %>_start"><%= Html.Encode(item.reservation_date_str) %></td>
							<td align="center"><input type="button" value="cancel" class="cancel_reservation" id="<%= Html.Encode(item.reservation_ID) %>" /></td>
						</tr>
						<% } %>
						</tbody>
				  	</table>
				  	<br /><br /><div class="sub_content">LOANS</div>
	   				<table width="100%" cellspacing="0">
	   					<thead>
	   				  		<td width="50%">Book Title</td>
	   				  		<td width="25%">Date Borrowed</td>
	   				  		<td width="25%">Date Due</td>
	   				  	</thead>   				  		
	   				  	<tbody id="bt_user">
						<% foreach (TestProject.Loan item in (ViewData["loans"] as List<TestProject.Loan>)) {%>
						<tr id="<%= Html.Encode(item.loan_ID) %>_row"<% if (Html.Encode(item.isOverdue)=="True"){ %> class="overdue_row" <% } %>>
							<td class="book_row" align="center" id="<%= Html.Encode(item.book_isbn) %>_title"><%= Html.Encode(item.bookTitle) %></td>
							<td align="center" id="<%= Html.Encode(item.loan_ID) %>_datestart"><%= Html.Encode(item.string_datestart) %></td>
							<td align="center" id="<%= Html.Encode(item.loan_ID) %>_dateend"><%= Html.Encode(item.string_dateend) %></td>
						</tr>
						<% } %>
						</tbody>
				  	</table>
				  	<font size="2">*Rows in <font color="#EE2C2C">red</font> mean that corresponding loans are past due date.</font>
				  	<br /><br /><div class="sub_content">RETURNED BOOKS</div>
	   				<table width="100%" cellspacing="0">
	   					<thead>
	   				  		<td width="40%">Book Title</td>
	   				  		<td width="20%">Date Borrowed</td>
	   				  		<td width="20%">Date Due</td>
	   				  		<td width="20%">Date Returned</td>
	   				  	</thead>   				  		
	   				  	<tbody id="bt_user">
						<% foreach (TestProject.Loan item in (ViewData["returned"] as List<TestProject.Loan>)) {%>
						<tr id="<%= Html.Encode(item.loan_ID) %>_row">
							<td class="book_row" align="center" id="<%= Html.Encode(item.book_isbn) %>_title"><%= Html.Encode(item.bookTitle) %></td>
							<td align="center" id="<%= Html.Encode(item.loan_ID) %>_datestart"><%= Html.Encode(item.string_datestart) %></td>
							<td align="center" id="<%= Html.Encode(item.loan_ID) %>_dateend"><%= Html.Encode(item.string_dateend) %></td>
							<td align="center" id="<%= Html.Encode(item.loan_ID) %>_datereturned"><%= Html.Encode(item.string_datereturned) %></td>
						</tr>
						<% } %>
						</tbody>
				  	</table>
   				 </div>				 
   			</div>
 			
 		</asp:Content>